<!-- 就诊人列表 -->
<template>
	<view class="patient-list-wrapper">
		<u-row customStyle="margin-bottom: 10px" justify="space-between" gutter="10">
			<u-col span="6" >
				<view class="patient-item add-button" @click="goToAddPatient">
					<p>添加就诊人</p>
				</view>
			</u-col>
			<u-col span="6" v-for="(item, index) in list" :key="index">
				<view class="patient-item">
					<p class="patient-name">{{item.names}}</p>
					<p>{{item.sex}} | {{item.age}}岁 | {{item.tizhong}}kg</p>
				</view>
			</u-col>
		</u-row>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad(option) {
			this.loadJiuZhenRen()
		},
		methods: {
			loadJiuZhenRen() {
				this.$app._get('entry/wxapp/user.alluserfamily', {
					openid: wx.getStorageSync("openid")
				}, (result) => {
					this.list = result
					console.log(result);
				})
			},
			goToAddPatient() {
				uni.navigateTo({
					url: "/pagesB/global/addPatient"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.patient-list-wrapper {
		width: 100%;
		height: 100%;
		background-color: #fff;
		padding: 20px;
		box-sizing: border-box;
		.patient-item {
			width: 100%;
			height: 100px;
			background-color: #66bb6a;
			color: #fff;
			border: 2px solid #43a047;
			border-radius: 6px;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			&.add-button {
				background-color: #e0e0e0;
				color: #000;
				border: 2px solid #9e9e9e;
				font-size: 1.1rem;
			}
			.patient-name {
				font-size: 1.2rem;
			}
		}
	}
</style>